package io.renren.controller;


import io.renren.common.utils.R;
import io.renren.socket.CommContent;
import io.renren.socket.EEs;
import io.renren.socket.Machine;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/test")
@Api(tags="测试接口")
public class EEsController {

    @GetMapping("t")
    @ApiOperation("忽略Token验证测试")
    public R notToken( CommContent commContent) throws IOException {
        //EEs.sendSocket(commContent);
       // System.out.println(EEs.machine);
       // Machine m = new Machine();
        if(EEs.machine.isBeiruqin()){
            commContent.setId("07");
            commContent.setFunction("0b");
            commContent.setData("000000000001");
            commContent.setCheck("5555");
            commContent.setEnd("a5a5a5");
            //EEs.sendSocket(commContent);
        }else {
            commContent.setId("07");
            commContent.setFunction("0b");
            commContent.setData("000000000000");
            commContent.setCheck("5555");
            commContent.setEnd("a5a5a5");
            //EEs.sendSocket(commContent);
        }
            EEs.sendSocket(commContent);

        return R.ok().put("msg", "测试成功").put("data",EEs.machine);

    }

    @GetMapping("send")
    @ApiOperation("忽略Token验证测试")
    public R send( CommContent c) throws IOException {
        EEs.sendSocket(c);
        return R.ok();
    }
}
